﻿#pragma once

#include "Containers/ThreadSafePtr.h"
#include "Scene/SceneNodeComponent.h"

#include "Math/Color.h"

#include "DirectionalLightComponent.m.h"

class CRenderDirectionalLight;

RCLASS() 
class WHENGINE_API RDirectionalLightComponent:public RSceneNodeComponent
{
    ROBJECT
public:

    RDirectionalLightComponent()=default;

    RFIELD()
    SColor Color=SColor::White;

    RFIELD()
    float Intensity=20.f;

    //光源距离被照射物体的距离
    //如果太大，则有些较远的物体会产生阴影，也会消耗更多的性能
    //如果太小，则有些较远的物体不会产生阴影
    RFIELD()
    float DistanceToTarget=1000;

    //级联阴影中每一级的最大到相机近平面的距离,目前只支持4级
    RFIELD()
    TVector<float> CascadeMaxDepths={ 100.f,400.f,1600.f,6400.f };

    //阴影偏移(0,1)
    RFIELD()
    float ShadowBias=0.001f;

protected:
    virtual void Paint(CRenderScene* InRenderData) override;

};